package leetcode_acm.array;

/**
 * 功能描述
 *
 * @author: 张庭杰
 * @date: 2023年03月17日 15:48
 */
public class RemoveDuplicates {
    public int removeDuplicates(int[] nums) {
        if(nums == null || nums.length == 0){
            return 0;
        }
        int slow = 0,fast = 1,n = nums.length;
        while(fast < n){
            if(nums[slow] == nums[fast]){
                fast++;
                continue;
            }
            nums[++slow] = nums[fast++];
        }
        return slow;
    }
}
